home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programmer Power Tools
/
Programmer Power Tools.iso
/
progjrn
/
pj_5_4.arc
/
PJ4-L1.ASM
< prev
next >
Wrap
Assembly Source File
|
1987-10-12
|
2KB
|
75 lines
; Listing 1.
; Program to illustrate operation of Map Mask register when drawing
; to memory that already contains data.
; Assembled with MASM 4.0, linked with LINK 3.51.
; Copyright by Michael Abrash, 4/26/87.
;
stack segment para stack 'STACK'
db 512 dup(?)
stack ends
;
EGA_VIDEO_SEGMENT equ 0a000h ;EGA display memory segment
;
; EGA register equates.
;
TS_INDEX equ 3c4h ;TS index register
TS_MAP_MASK equ 2 ;TS map mask register
;
; Macro to set indexed register INDEX of TS chip to SETTING.
;
SETTS macro INDEX, SETTING
mov dx,TS_INDEX
mov al,INDEX
out dx,al
inc dx
mov al,SETTING
out dx,al
dec dx
endm
;
cseg segment para public 'CODE'
assume cs:cseg
start proc near
;
; Select 640x350 graphics mode.
;
mov ax,010h
int 10h
;
mov ax,EGA_VIDEO_SEGMENT
mov es,ax ;point to video memory
;
; Draw 18 10-scan-line high horizontal bars in green, 10 scan lines apart.
;
SETTS TS_MAP_MASK,02h ;map mask setting enables only
; plane 1, the green plane
sub di,di ;start at beginning of video memory
mov al,0ffh
mov bp,18 ;# bars to draw
HorzBarLoop:
mov cx,80*10 ;# bytes per horizontal bar
rep stosb ;draw bar
add di,80*10 ;point to start of next bar
dec bp
jnz HorzBarLoop
;
; Fill screen with blue, using Map Mask register to enable writes
; to blue plane only.
;
SETTS TS_MAP_MASK,01h ;map mask setting enables only
; plane 0, the blue plane
sub di,di
mov cx,80*350 ;# bytes per screen
mov al,0ffh
rep stosb ;perform fill (affects only
; plane 0, the blue plane)
;
; Exit to DOS.
;
mov ah,4ch
int 21h
start endp
cseg ends
end start